#include <stdio.h>
int main (){
    int arr1[]={1,2,3,4,5,6,7,8,9};
    int k=17;
    int left,right,mid;
    left=0;
    int sz=sizeof(arr1)/sizeof(arr1[0]);
    right=sz-1;
    while (left<=right){
        mid=(left+right)/2;
        if(arr1[mid]==k){
            printf("找到了，下标是:%d\n",mid);
            break;
        }
        if(arr1[mid]<k){
            left =mid+1;
        }
        else{right=mid-1;}
        if(right<left)
        {
            printf("找不到\n");
        }
        }
    }
